﻿using System;
using System.ComponentModel;
using System.IO;
using System.Runtime.Serialization;

namespace HalconDotNet
{
	/// <summary>Represents an instance of a k-NearestNeighbor classifier.</summary>
	// Token: 0x02000022 RID: 34
	[Serializable]
	public class HClassKnn : HHandle, ISerializable, ICloneable
	{
		// Token: 0x060002A7 RID: 679 RVA: 0x0000883B File Offset: 0x00006A3B
		[EditorBrowsable(EditorBrowsableState.Never)]
		public HClassKnn() : base(HHandleBase.UNDEF)
		{
		}

		// Token: 0x060002A8 RID: 680 RVA: 0x00010930 File Offset: 0x0000EB30
		[EditorBrowsable(EditorBrowsableState.Never)]
		public HClassKnn(IntPtr handle) : base(handle)
		{
			this.AssertSemType();
		}

		// Token: 0x060002A9 RID: 681 RVA: 0x0001093F File Offset: 0x0000EB3F
		[EditorBrowsable(EditorBrowsableState.Never)]
		public HClassKnn(HHandle handle) : base(handle)
		{
			this.AssertSemType();
		}

		// Token: 0x060002AA RID: 682 RVA: 0x0001094E File Offset: 0x0000EB4E
		private void AssertSemType()
		{
			base.AssertSemType("class_knn");
		}

		// Token: 0x060002AB RID: 683 RVA: 0x0001095B File Offset: 0x0000EB5B
		internal static int LoadNew(IntPtr proc, int parIndex, int err, out HClassKnn obj)
		{
			obj = new HClassKnn(HHandleBase.UNDEF);
			return obj.Load(proc, parIndex, err);
		}

		// Token: 0x060002AC RID: 684 RVA: 0x00010974 File Offset: 0x0000EB74
		internal static int LoadNew(IntPtr proc, int parIndex, int err, out HClassKnn[] obj)
		{
			HTuple htuple;
			err = HTuple.LoadNew(proc, parIndex, err, out htuple);
			obj = new HClassKnn[htuple.Length];
			for (int i = 0; i < htuple.Length; i++)
			{
				obj[i] = new HClassKnn(HalconAPI.IsLegacyHandleMode() ? htuple[i].IP : htuple[i].H);
			}
			htuple.Dispose();
			return err;
		}

		/// <summary>
		///   Read the k-NN classifier from a file.
		///   Modified instance represents: Handle of the k-NN classifier.
		/// </summary>
		/// <param name="fileName">File name of the classifier.</param>
		// Token: 0x060002AD RID: 685 RVA: 0x000109E4 File Offset: 0x0000EBE4
		public HClassKnn(string fileName)
		{
			IntPtr proc = HalconAPI.PreCall(1809);
			HalconAPI.StoreS(proc, 0, fileName);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Create a k-nearest neighbors (k-NN) classifier.
		///   Modified instance represents: Handle of the k-NN classifier.
		/// </summary>
		/// <param name="numDim">Number of dimensions of the feature. Default: 10</param>
		// Token: 0x060002AE RID: 686 RVA: 0x00010A30 File Offset: 0x0000EC30
		public HClassKnn(HTuple numDim)
		{
			IntPtr proc = HalconAPI.PreCall(1816);
			HalconAPI.Store(proc, 0, numDim);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(numDim);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
		}

		// Token: 0x060002AF RID: 687 RVA: 0x00010A84 File Offset: 0x0000EC84
		void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
		{
			HSerializedItem hserializedItem = this.SerializeClassKnn();
			byte[] value = hserializedItem;
			hserializedItem.Dispose();
			info.AddValue("data", value, typeof(byte[]));
		}

		// Token: 0x060002B0 RID: 688 RVA: 0x00010ABC File Offset: 0x0000ECBC
		[EditorBrowsable(EditorBrowsableState.Never)]
		public HClassKnn(SerializationInfo info, StreamingContext context)
		{
			HSerializedItem hserializedItem = new HSerializedItem((byte[])info.GetValue("data", typeof(byte[])));
			this.DeserializeClassKnn(hserializedItem);
			hserializedItem.Dispose();
		}

		/// <summary>Serialize object to binary stream in HALCON format</summary>
		// Token: 0x060002B1 RID: 689 RVA: 0x00010AFC File Offset: 0x0000ECFC
		public new void Serialize(Stream stream)
		{
			HSerializedItem hserializedItem = this.SerializeClassKnn();
			hserializedItem.Serialize(stream);
			hserializedItem.Dispose();
		}

		/// <summary>Deserialize object from binary stream in HALCON format</summary>
		// Token: 0x060002B2 RID: 690 RVA: 0x00010B10 File Offset: 0x0000ED10
		public new static HClassKnn Deserialize(Stream stream)
		{
			HClassKnn hclassKnn = new HClassKnn();
			HSerializedItem hserializedItem = HSerializedItem.Deserialize(stream);
			hclassKnn.DeserializeClassKnn(hserializedItem);
			hserializedItem.Dispose();
			return hclassKnn;
		}

		// Token: 0x060002B3 RID: 691 RVA: 0x00010B36 File Offset: 0x0000ED36
		object ICloneable.Clone()
		{
			return this.Clone();
		}

		// Token: 0x060002B4 RID: 692 RVA: 0x00010B40 File Offset: 0x0000ED40
		public new HClassKnn Clone()
		{
			HSerializedItem hserializedItem = this.SerializeClassKnn();
			HClassKnn hclassKnn = new HClassKnn();
			hclassKnn.DeserializeClassKnn(hserializedItem);
			hserializedItem.Dispose();
			return hclassKnn;
		}

		/// <summary>
		///   Classify an image with a k-Nearest-Neighbor classifier.
		///   Instance represents: Handle of the k-NN classifier.
		/// </summary>
		/// <param name="image">Input image.</param>
		/// <param name="distanceImage">Distance of the pixel's nearest neighbor.</param>
		/// <param name="rejectionThreshold">Threshold for the rejection of the classification. Default: 0.5</param>
		/// <returns>Segmented classes.</returns>
		// Token: 0x060002B5 RID: 693 RVA: 0x00010B68 File Offset: 0x0000ED68
		public HRegion ClassifyImageClassKnn(HImage image, out HImage distanceImage, double rejectionThreshold)
		{
			IntPtr proc = HalconAPI.PreCall(429);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, image);
			HalconAPI.StoreD(proc, 1, rejectionThreshold);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			int num = HalconAPI.CallProcedure(proc);
			HRegion result;
			num = HRegion.LoadNew(proc, 1, num, out result);
			num = HImage.LoadNew(proc, 2, num, out distanceImage);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(image);
			return result;
		}

		/// <summary>
		///   Add training samples from an image to the training data of a k-Nearest-Neighbor classifier.
		///   Instance represents: Handle of the k-NN classifier.
		/// </summary>
		/// <param name="image">Training image.</param>
		/// <param name="classRegions">Regions of the classes to be trained.</param>
		// Token: 0x060002B6 RID: 694 RVA: 0x00010BD8 File Offset: 0x0000EDD8
		public void AddSamplesImageClassKnn(HImage image, HRegion classRegions)
		{
			IntPtr proc = HalconAPI.PreCall(430);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, image);
			HalconAPI.Store(proc, 2, classRegions);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
			GC.KeepAlive(image);
			GC.KeepAlive(classRegions);
		}

		/// <summary>
		///   Get the training data of a k-nearest neighbors (k-NN) classifier.
		///   Instance represents: Handle of the k-NN classifier  that contains training data.
		/// </summary>
		/// <returns>Handle of the training data of the classifier.</returns>
		// Token: 0x060002B7 RID: 695 RVA: 0x00010C28 File Offset: 0x0000EE28
		public HClassTrainData GetClassTrainDataKnn()
		{
			IntPtr proc = HalconAPI.PreCall(1789);
			base.Store(proc, 0);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HClassTrainData result;
			num = HClassTrainData.LoadNew(proc, 0, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Add training data to a k-nearest neighbors (k-NN) classifier.
		///   Instance represents: Handle of a k-NN which receives the  training data.
		/// </summary>
		/// <param name="classTrainDataHandle">Training data for a classifier.</param>
		// Token: 0x060002B8 RID: 696 RVA: 0x00010C70 File Offset: 0x0000EE70
		public void AddClassTrainDataKnn(HClassTrainData classTrainDataHandle)
		{
			IntPtr proc = HalconAPI.PreCall(1790);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, classTrainDataHandle);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
			GC.KeepAlive(classTrainDataHandle);
		}

		/// <summary>
		///   Selects an optimal subset from a set of features to solve a certain  classification problem.
		///   Modified instance represents: A trained k-NN classifier using only the selected  features.
		/// </summary>
		/// <param name="classTrainDataHandle">Handle of the training data.</param>
		/// <param name="selectionMethod">Method to perform the selection. Default: "greedy"</param>
		/// <param name="genParamName">Names of generic parameters to configure the selection process and the classifier. Default: []</param>
		/// <param name="genParamValue">Values of generic parameters to configure the  selection process and the classifier. Default: []</param>
		/// <param name="score">The achieved score using two-fold cross-validation.</param>
		/// <returns>The selected feature set, contains  indices or names.</returns>
		// Token: 0x060002B9 RID: 697 RVA: 0x00010CB4 File Offset: 0x0000EEB4
		public HTuple SelectFeatureSetKnn(HClassTrainData classTrainDataHandle, string selectionMethod, HTuple genParamName, HTuple genParamValue, out HTuple score)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(1802);
			HalconAPI.Store(proc, 0, classTrainDataHandle);
			HalconAPI.StoreS(proc, 1, selectionMethod);
			HalconAPI.Store(proc, 2, genParamName);
			HalconAPI.Store(proc, 3, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			num = base.Load(proc, 0, num);
			HTuple result;
			num = HTuple.LoadNew(proc, 1, num, out result);
			num = HTuple.LoadNew(proc, 2, HTupleType.DOUBLE, num, out score);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(classTrainDataHandle);
			return result;
		}

		/// <summary>
		///   Selects an optimal subset from a set of features to solve a certain  classification problem.
		///   Modified instance represents: A trained k-NN classifier using only the selected  features.
		/// </summary>
		/// <param name="classTrainDataHandle">Handle of the training data.</param>
		/// <param name="selectionMethod">Method to perform the selection. Default: "greedy"</param>
		/// <param name="genParamName">Names of generic parameters to configure the selection process and the classifier. Default: []</param>
		/// <param name="genParamValue">Values of generic parameters to configure the  selection process and the classifier. Default: []</param>
		/// <param name="score">The achieved score using two-fold cross-validation.</param>
		/// <returns>The selected feature set, contains  indices or names.</returns>
		// Token: 0x060002BA RID: 698 RVA: 0x00010D54 File Offset: 0x0000EF54
		public HTuple SelectFeatureSetKnn(HClassTrainData classTrainDataHandle, string selectionMethod, string genParamName, double genParamValue, out HTuple score)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(1802);
			HalconAPI.Store(proc, 0, classTrainDataHandle);
			HalconAPI.StoreS(proc, 1, selectionMethod);
			HalconAPI.StoreS(proc, 2, genParamName);
			HalconAPI.StoreD(proc, 3, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			HTuple result;
			num = HTuple.LoadNew(proc, 1, num, out result);
			num = HTuple.LoadNew(proc, 2, HTupleType.DOUBLE, num, out score);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(classTrainDataHandle);
			return result;
		}

		/// <summary>
		///   Clear a k-NN classifier.
		///   Instance represents: Handle of the k-NN classifier.
		/// </summary>
		// Token: 0x060002BB RID: 699 RVA: 0x00010DE8 File Offset: 0x0000EFE8
		public void ClearClassKnn()
		{
			IntPtr proc = HalconAPI.PreCall(1804);
			base.Store(proc, 0);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Return the number of training samples stored in the training data of a k-nearest neighbors (k-NN) classifier.
		///   Instance represents: Handle of the k-NN classifier.
		/// </summary>
		/// <returns>Number of stored training samples.</returns>
		// Token: 0x060002BC RID: 700 RVA: 0x00010E1C File Offset: 0x0000F01C
		public int GetSampleNumClassKnn()
		{
			IntPtr proc = HalconAPI.PreCall(1805);
			base.Store(proc, 0);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			int result;
			num = HalconAPI.LoadI(proc, 0, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Return a training sample from the training data of a k-nearest neighbors  (k-NN) classifier.
		///   Instance represents: Handle of the k-NN classifier.
		/// </summary>
		/// <param name="indexSample">Index of the training sample.</param>
		/// <param name="classID">Class of the training sample.</param>
		/// <returns>Feature vector of the training sample.</returns>
		// Token: 0x060002BD RID: 701 RVA: 0x00010E64 File Offset: 0x0000F064
		public HTuple GetSampleClassKnn(int indexSample, out HTuple classID)
		{
			IntPtr proc = HalconAPI.PreCall(1806);
			base.Store(proc, 0);
			HalconAPI.StoreI(proc, 1, indexSample);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			int num = HalconAPI.CallProcedure(proc);
			HTuple result;
			num = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, num, out result);
			num = HTuple.LoadNew(proc, 1, HTupleType.INTEGER, num, out classID);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Deserialize a serialized k-NN classifier.
		///   Modified instance represents: Handle of the k-NN classifier.
		/// </summary>
		/// <param name="serializedItemHandle">Handle of the serialized item.</param>
		// Token: 0x060002BE RID: 702 RVA: 0x00010EC8 File Offset: 0x0000F0C8
		public void DeserializeClassKnn(HSerializedItem serializedItemHandle)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(1807);
			HalconAPI.Store(proc, 0, serializedItemHandle);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(serializedItemHandle);
		}

		/// <summary>
		///   Serialize a k-NN classifier.
		///   Instance represents: Handle of the k-NN classifier.
		/// </summary>
		/// <returns>Handle of the serialized item.</returns>
		// Token: 0x060002BF RID: 703 RVA: 0x00010F1C File Offset: 0x0000F11C
		public HSerializedItem SerializeClassKnn()
		{
			IntPtr proc = HalconAPI.PreCall(1808);
			base.Store(proc, 0);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HSerializedItem result;
			num = HSerializedItem.LoadNew(proc, 0, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Read the k-NN classifier from a file.
		///   Modified instance represents: Handle of the k-NN classifier.
		/// </summary>
		/// <param name="fileName">File name of the classifier.</param>
		// Token: 0x060002C0 RID: 704 RVA: 0x00010F64 File Offset: 0x0000F164
		public void ReadClassKnn(string fileName)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(1809);
			HalconAPI.StoreS(proc, 0, fileName);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Save the k-NN classifier in a file.
		///   Instance represents: Handle of the k-NN classifier.
		/// </summary>
		/// <param name="fileName">Name of the file in which the classifier will be written.</param>
		// Token: 0x060002C1 RID: 705 RVA: 0x00010FB0 File Offset: 0x0000F1B0
		public void WriteClassKnn(string fileName)
		{
			IntPtr proc = HalconAPI.PreCall(1810);
			base.Store(proc, 0);
			HalconAPI.StoreS(proc, 1, fileName);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Get parameters of a k-NN classification.
		///   Instance represents: Handle of the k-NN classifier.
		/// </summary>
		/// <param name="genParamName">Names of the parameters that can be read from the k-NN classifier. Default: ["method","k"]</param>
		/// <returns>Values of the selected parameters.</returns>
		// Token: 0x060002C2 RID: 706 RVA: 0x00010FEC File Offset: 0x0000F1EC
		public HTuple GetParamsClassKnn(HTuple genParamName)
		{
			IntPtr proc = HalconAPI.PreCall(1811);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, genParamName);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(genParamName);
			HTuple result;
			num = HTuple.LoadNew(proc, 0, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Set parameters for k-NN classification.
		///   Instance represents: Handle of the k-NN classifier.
		/// </summary>
		/// <param name="genParamName">Names of the generic parameters that can be adjusted for the k-NN classifier. Default: ["method","k","max_num_classes"]</param>
		/// <param name="genParamValue">Values of the generic parameters that can be adjusted for the k-NN classifier. Default: ["classes_distance",5,1]</param>
		// Token: 0x060002C3 RID: 707 RVA: 0x00011044 File Offset: 0x0000F244
		public void SetParamsClassKnn(HTuple genParamName, HTuple genParamValue)
		{
			IntPtr proc = HalconAPI.PreCall(1812);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, genParamName);
			HalconAPI.Store(proc, 2, genParamValue);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Search for the next neighbors for a given feature vector.
		///   Instance represents: Handle of the k-NN classifier.
		/// </summary>
		/// <param name="features">Features that should be classified.</param>
		/// <param name="rating">A rating for the results. This value contains either a  distance, a frequency or a weighted frequency.</param>
		/// <returns>The classification result, either class IDs or sample  indices.</returns>
		// Token: 0x060002C4 RID: 708 RVA: 0x00011094 File Offset: 0x0000F294
		public HTuple ClassifyClassKnn(HTuple features, out HTuple rating)
		{
			IntPtr proc = HalconAPI.PreCall(1813);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, features);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(features);
			HTuple result;
			num = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, num, out result);
			num = HTuple.LoadNew(proc, 1, HTupleType.DOUBLE, num, out rating);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Creates the search trees for a k-NN classifier.
		///   Instance represents: Handle of the k-NN classifier.
		/// </summary>
		/// <param name="genParamName">Names of the generic parameters that can be adjusted for the k-NN classifier creation. Default: []</param>
		/// <param name="genParamValue">Values of the generic parameters that can be adjusted for the k-NN classifier creation. Default: []</param>
		// Token: 0x060002C5 RID: 709 RVA: 0x00011100 File Offset: 0x0000F300
		public void TrainClassKnn(HTuple genParamName, HTuple genParamValue)
		{
			IntPtr proc = HalconAPI.PreCall(1814);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, genParamName);
			HalconAPI.Store(proc, 2, genParamValue);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Add a sample to a  k-nearest neighbors (k-NN) classifier.
		///   Instance represents: Handle of the k-NN classifier.
		/// </summary>
		/// <param name="features">List of features to add.</param>
		/// <param name="classID">Class IDs of the features.</param>
		// Token: 0x060002C6 RID: 710 RVA: 0x00011150 File Offset: 0x0000F350
		public void AddSampleClassKnn(HTuple features, HTuple classID)
		{
			IntPtr proc = HalconAPI.PreCall(1815);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, features);
			HalconAPI.Store(proc, 2, classID);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(features);
			HalconAPI.UnpinTuple(classID);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Add a sample to a  k-nearest neighbors (k-NN) classifier.
		///   Instance represents: Handle of the k-NN classifier.
		/// </summary>
		/// <param name="features">List of features to add.</param>
		/// <param name="classID">Class IDs of the features.</param>
		// Token: 0x060002C7 RID: 711 RVA: 0x000111A0 File Offset: 0x0000F3A0
		public void AddSampleClassKnn(double features, int classID)
		{
			IntPtr proc = HalconAPI.PreCall(1815);
			base.Store(proc, 0);
			HalconAPI.StoreD(proc, 1, features);
			HalconAPI.StoreI(proc, 2, classID);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Create a k-nearest neighbors (k-NN) classifier.
		///   Modified instance represents: Handle of the k-NN classifier.
		/// </summary>
		/// <param name="numDim">Number of dimensions of the feature. Default: 10</param>
		// Token: 0x060002C8 RID: 712 RVA: 0x000111E4 File Offset: 0x0000F3E4
		public void CreateClassKnn(HTuple numDim)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(1816);
			HalconAPI.Store(proc, 0, numDim);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(numDim);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Create a look-up table using a k-nearest neighbors classifier (k-NN) to classify byte images.
		///   Instance represents: Handle of the k-NN classifier.
		/// </summary>
		/// <param name="genParamName">Names of the generic parameters that can be adjusted for the LUT classifier creation. Default: []</param>
		/// <param name="genParamValue">Values of the generic parameters that can be adjusted for the LUT classifier creation. Default: []</param>
		/// <returns>Handle of the LUT classifier.</returns>
		// Token: 0x060002C9 RID: 713 RVA: 0x00011238 File Offset: 0x0000F438
		public HClassLUT CreateClassLutKnn(HTuple genParamName, HTuple genParamValue)
		{
			IntPtr proc = HalconAPI.PreCall(1819);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, genParamName);
			HalconAPI.Store(proc, 2, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			HClassLUT result;
			num = HClassLUT.LoadNew(proc, 0, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}
	}
}
